import request from '@/utils/request'

// 查询保养计划列表
export function listMaintenancePlan(query) {
  return request({
    url: '/ldzl-sb/maintenance/plan/findAll/',
    method: 'get',
    params: query
  })
}

// 查询保养计划详细
export function getMaintenancePlan(id) {
  return request({
    url: '/ldzl-sb/maintenance/plan/findById/',
    method: 'get',
    params: { plan_id: id }
  })
}

// 新增保养计划
export function addMaintenancePlan(data) {
  return request({
    url: '/ldzl-sb/maintenance/plan/save/',
    method: 'post',
    data: data
  })
}

// 修改保养计划
export function updateMaintenancePlan(data) {
  return request({
    url: '/ldzl-sb/maintenance/plan/update/',
    method: 'post',
    data: data
  })
}

// 删除保养计划
export function delMaintenancePlan(id) {
  return request({
    url: '/ldzl-sb/maintenance/plan/delete/',
    method: 'get',
    params: { plan_id: id }
  })
}

// 获取自动生成的保养计划编码
export function generateMaintenancePlanCode() {
  return request({
    url: '/ldzl-sb/maintenance/plan/getNumber/',
    method: 'get'
  })
}

// 查询保养项目列表
export function listMaintenanceItem(query) {
  return request({
    url: '/ldzl-sb/maintenance/item/findAll/',
    method: 'get',
    params: query
  })
}

// 查询保养项目详细
export function getMaintenanceItem(id) {
  return request({
    url: '/ldzl-sb/maintenance/item/findById/',
    method: 'get',
    params: { item_id: id }
  })
}

// 新增保养项目
export function addMaintenanceItem(data) {
  return request({
    url: '/ldzl-sb/maintenance/item/save/',
    method: 'post',
    data: data
  })
}

// 修改保养项目
export function updateMaintenanceItem(data) {
  return request({
    url: '/ldzl-sb/maintenance/item/update/',
    method: 'post',
    data: data
  })
}

// 删除保养项目
export function delMaintenanceItem(id) {
  return request({
    url: '/ldzl-sb/maintenance/item/delete/',
    method: 'get',
    params: { item_id: id }
  })
}

// 查询保养记录列表
export function listMaintenanceRecord(query) {
  return request({
    url: '/ldzl-sb/maintenance/record/findAll/',
    method: 'get',
    params: query
  })
}

// 查询保养记录详细
export function getMaintenanceRecord(id) {
  return request({
    url: '/ldzl-sb/maintenance/record/findById/',
    method: 'get',
    params: { record_id: id }
  })
}

// 新增保养记录
export function addMaintenanceRecord(data) {
  return request({
    url: '/ldzl-sb/maintenance/record/save/',
    method: 'post',
    data: data
  })
}

// 修改保养记录
export function updateMaintenanceRecord(data) {
  return request({
    url: '/ldzl-sb/maintenance/record/update/',
    method: 'post',
    data: data
  })
}

// 删除保养记录
export function delMaintenanceRecord(id) {
  return request({
    url: '/ldzl-sb/maintenance/record/delete/',
    method: 'get',
    params: { record_id: id }
  })
}

// 完成保养
export function completeMaintenance(data) {
  return request({
    url: '/ldzl-sb/maintenance/record/complete/',
    method: 'post',
    data: data
  })
} 